//
//  ViewController.swift
//  SSCXY
//
//  Created by sujeking on 2020/1/14.
//  Copyright © 2020 sujeking. All rights reserved.
//

import UIKit
import FlexLib

class ViewController: FlexBaseVC {
    
    @objc var kmodal : FlexModalView!
    
    var setting : String = "" {
        willSet{
            print("hahahhaha")
            print(newValue)
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
//        self.kmodal.setViewAttr("position", value: "left")
//        self.kmodal.showModal(in: self.view, anim: true)
        
//        let data = NSData(contentsOfFile: "/usr/local/var/www/wzg/base.xml")
//        self.reset(byFlexData: data as Data?)
//        self.netFetchXMLData()
    }
    
//    @objc func dismissac() {
//        self.kmodal.hideModal(true)
//    }
    
    // MARK: - NET
    
    func netFetchXMLData() {
        DispatchQueue.global(qos: .userInitiated).async {
            let url = URL(string: "http://192.168.0.222:8080/wzg/base.xml")
            let req : URLRequest = URLRequest(url: url!)
            let session = URLSession(configuration: URLSessionConfiguration.default)
            weak var ws = self
            let task = session.dataTask(with: req) { (data, res, error) in
                ws!.reset(byFlexData: data)
            }
            task.resume()
        }
    }
}

